﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Specialized;

namespace CentralOffice.WebClient.Tasks
{
    public partial class ApprovalTimeSpan : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                txtDateOfApplication.Text = DateTime.Parse(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-01").ToString("yyyy-MM-dd");
                txtDateOfApplicationEnd.Text = DateTime.Now.ToString("yyyy-MM-dd");
            }

        }

        protected void odsApproval_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            //int status = EnumUtil.GetInt32(SiteConstants.ApprovalStatus, CategoryDataSourceType.Xml, "通过");

            IOrderedDictionary parameters = e.InputParameters;

            //parameters["delay"] = SiteUtil.GetDefaultWarningDate().ToString();
            parameters["deduct"] = SiteUtil.GetDeductPerMinute().ToString();

            parameters["start"] = txtDateOfApplication.Text.Length == 0 ? DateTime.Parse(DateTime.Now.Year.ToString() + "-" +  DateTime.Now.Month.ToString() + "-01") : DateTime.Parse(txtDateOfApplication.Text);
            parameters["end"] = txtDateOfApplicationEnd.Text.Length == 0 ? DateTime.Now : DateTime.Parse(txtDateOfApplicationEnd.Text);
            //ApprovalRow approval = (new ApprovalDataSet()).Approvals.NewApprovalsRow();
            //approval.ApprovedBy = CommonUtil.TrimAll(ApplicationContext.ActualUserName);
            //parameters["whereClause"] = task.FilterExpression;

        }
    }
}
